package com.cnap.model.application;

import com.cnap.model.cloud.CloudVendorsEnum;
import com.cnap.model.schedule.engine.alg.AccountName;

import java.util.ArrayList;
import java.util.List;

/**
 * <类文件描述>
 *
 * @author xc
 **/
public class DeployResourceInfo {
    /**
     * public  private
     */
    private String cloudScope;
    private List<ResourceInfo> resourceInfos;

    /**
     * get
     *
     * @return CloudScope
     */
    public String getCloudScope() {
        return cloudScope;
    }

    /**
     * set
     *
     * @param cloudScope cloudScope
     */
    public void setCloudScope(String cloudScope) {
        this.cloudScope = cloudScope;
    }

    /**
     * get
     *
     * @return ResourceInfos
     */
    public List<ResourceInfo> getResourceInfos() {
        return resourceInfos;
    }

    /**
     * set
     *
     * @param resourceInfos resourceInfos
     */
    public void setResourceInfos(List<ResourceInfo> resourceInfos) {
        this.resourceInfos = resourceInfos;
    }

    /**
     * 转换成算法引擎处的云商参数
     *
     * @return 结果
     */
    public List<AccountName> transToEngineCloudParam() {
        List<AccountName> accountNames = new ArrayList<>();
        for (ResourceInfo resourceInfo : resourceInfos) {
            AccountName accountName = new AccountName();
            accountName.setAccountName(resourceInfo.getAccountName());
            accountName.setCloudType(CloudVendorsEnum.changeFromDescribeToCloudType(resourceInfo.getCloudVendor()));
            accountNames.add(accountName);
        }
        return accountNames;
    }
}
